package com.lizi.apidoc.utils;

import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaMethod;

import java.util.List;

/**
 * 文档注释通用类
 *
 * @author kingman zhangjw@3vjia.com
 * @since 2020-05-07 12:26
 */
public class DocTagUtil {

    /**
     * 得到标签值
     * @param javaMethod
     * @param tagName
     * @return
     */
    public static String getTagValue(final JavaMethod javaMethod, String tagName){
        List<DocletTag> paramTags = javaMethod.getTagsByName(tagName);
        if(ArraysUtil.isNullOrEmpty(paramTags))
        {
            return StringUtil.getEmpty();
        }
        DocletTag fistTag = paramTags.get(0);
        String value = fistTag.getValue();

        return value;
    }
}
